//
//  TTPictureViewCell.m
//  TTWeibo
//
//  Created by 陶宏路 on 16/7/30.
//  Copyright © 2016年 陶路路. All rights reserved.


#import "TTPictureViewCell.h"

@interface TTPictureViewCell ()

@property (nonatomic,strong) UIImageView * picture;

@end
@implementation TTPictureViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self setUpUI];
    }
    
    return self;
}

-(void)setUpUI{
    
    [self addSubview:self.picture];
    
    [self.picture mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.leading.trailing.equalTo(self.contentView);
    }];
    
}

#pragma mark 处理图片 contentMode  _picture.layer.masksToBounds

-(UIImageView *)picture{
    
    if (_picture == nil) {
        
        _picture = [[UIImageView alloc]init];
        _picture.contentMode = UIViewContentModeScaleAspectFill;
        _picture.layer.masksToBounds = YES;
    }
    
    return _picture;
}

-(void)setModel:(TTPictureModel *)model{
    
    _model = model;
    
    [self.picture sd_setImageWithURL:[NSURL URLWithString:model.thumbnail_pic]];
}
@end
